package com.baibei.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;

/**
 * {
 * "ordernum":"1234", #订单号
 * "name":"征服波尔多陈年XO", #商品名称
 * "area":"XPT", #产区
 * "last":12345, #最新价
 * "buyprice":1234, #买入价
 * "count":10, #数量
 * "buydirection":1, #订货类型 1：现价，2：结算价
 * "buyMoney":12344, #定金
 * "fee":12345, #订货服务费
 * "toplimit":30, #上升
 * "bottomlimit":20, #下降
 * "addtime":"12345678977655" #下单时间，时间戳
 * }
 * <p>
 * {
 * "orderid": 464,
 * "ordernum": "312300060117081617201995", #订单号
 * "wid": "6e6eaa634f304ffc81b5d320e87fa416123",
 * "ordertype": 3,
 * "buydirection": 2,
 * "productid": 2,
 * "buyprice": 166.16, #订货金额
 * "sellprice":156.11, #退订金额
 * "buymoney": 30, #订金
 * "fee": 0.6,
 * "count": 1,
 * "toplimit": 0.2,
 * "bottomlimit": 0.2,
 * "plamount": 1, #盈亏金额（订单差价）
 * "actualAmount":0.4, #实际差价
 * "addtime": "1502875195000", #订单时间
 * "selltime": null, #退订时间
 * "name": "征服波尔多经典XO", #商品名称
 * "area": "XPT",
 * "last": null,
 * "productpic": "http://crossboarder.oss-cn-shenzhen.aliyuncs.com/trade/product/020170808172050.jpg?x-oss-process=image/resize,m_mfit,h_100,w_100"
 * }
 * Created by shenminjie on 2017/8/9.
 * mail:shenminjie@100bei.com
 */

public class MessageInfo implements DateInfo, Parcelable, Serializable {

    /**
     * id : 1
     * type : 1
     * content : 111
     * time : 2019-09-01
     */

    private int id;
    private int type;
    private String content;
    private String time;
    private String addTime;

    private String state;
    private String createdTime;
    private String title;

    public String getAddTime() {
        return addTime;
    }

    public void setAddTime(String addTime) {
        this.addTime = addTime;
    }

    public static Creator<MessageInfo> getCREATOR() {
        return CREATOR;
    }

    public MessageInfo(Parcel in) {
        id = in.readInt();
        type = in.readInt();
        content = in.readString();
        addTime = in.readString();
        time = in.readString();
    }

    public static final Creator<MessageInfo> CREATOR = new Creator<MessageInfo>() {
        @Override
        public MessageInfo createFromParcel(Parcel in) {
            return new MessageInfo(in);
        }

        @Override
        public MessageInfo[] newArray(int size) {
            return new MessageInfo[size];
        }
    };

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(id);
        parcel.writeInt(type);
        parcel.writeString(content);
        parcel.writeString(time);
        parcel.writeString(addTime);
    }

    public MessageInfo(int id, int type, String content, String time,String addTime) {
        this.id = id;
        this.type = type;
        this.content = content;
        this.time = time;
        this.addTime = addTime;

    }

    @Override
    public long getDate() {
        return Long.parseLong(addTime);
    }
}
